<?php 
    $this->headMeta()->appendHttpEquiv('Content-Type','text/html;charset=utf-8'); 
    $this->headTitle()->setSeparator(' - '); 
    $this->headTitle('DVT.GROUP'); 
    $auth = new My_Authuser();
    $info=$auth->checkAuthentication();
    if(isset($info['userId']) && $info['userId']){
        $modelUser = new Default_Model_User();        
        $userCheck = $modelUser->getDataUserById($info['userId']);
        if(isset($userCheck)){$userCheck=$userCheck->toArray();}         
    }                
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<?php echo BASE_URL1;?>" />
		<meta charset="utf-8"/>
		<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
		<meta name="viewport" content="width=device-width, initial-scale=1"/>		
		<meta name="author" content=""/>
		<link rel="icon" href="<?php echo BASE_URL ?>/static/images/favicon.ico"/>
		<?php echo $this->headMeta(); ?>
		<?php echo $this->headTitle(); ?>
		
        <!-- Bootstrap core CSS -->
		<link href="<?php echo BASE_URL ?>/static/css/bootstrap.min.css" rel="stylesheet"/>
        <!-- Simple sidebar -->
        <link href="<?php echo BASE_URL ?>/static/css/simple-sidebar.css" rel="stylesheet"/>
        
		<link href="<?php echo BASE_URL ?>/static/default-template/css/style.css" rel="stylesheet"/>
		<!--<link href="<?php echo BASE_URL ?>/static/css/style-responsive.css" rel="stylesheet"/>-->
        <link href="<?php echo BASE_URL ?>/static/default-template/css/style-responsive.css" rel="stylesheet"/>
        <!-- Datetime Picker CSS -->        
        <link href="<?php echo BASE_URL ?>/static/css/jquery.datetimepicker.css" rel="stylesheet"/>
        <!--Lean Slider v1.0.1-->
        <link rel="stylesheet" href="<?php echo BASE_URL ?>/static/default-template/css/lean-slider.css" type="text/css" />
        <link rel="stylesheet" href="<?php echo BASE_URL ?>/static/default-template/css/sample-styles.css" type="text/css" />
                
        <script src="<?php echo BASE_URL ?>/static/js/nicEdit.js"></script>
		<script src="<?php echo BASE_URL ?>/static/js/ie-emulation-modes-warning.js">
		</script>
		<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
		<script src="<?php echo BASE_URL ?>/static/js/ie10-viewport-bug-workaround.js">
		</script>        
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!--[if lt IE 9]>
			<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js">
			</script>
			<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js">
			</script>
		<![endif]-->
        <script src="<?php echo BASE_URL ?>/static/js/jquery-1.11.1.min.js" type="text/javascript"></script>
        <!-- Bootstrap core JavaScript - start================================================-->
		<script src="<?php echo BASE_URL ?>/static/js/bootstrap.min.js" type="text/javascript"></script>
        <!-- Fancybox -->
        <script src="<?php echo BASE_URL ?>/static/addon/fancybox-2.1.5/jquery.mousewheel.pack.js" type="text/javascript"></script>
        <link href="<?php echo BASE_URL ?>/static/addon/fancybox-2.1.5/jquery.fancybox.css" rel="stylesheet" type="text/css" media="screen" />
        <script src="<?php echo BASE_URL ?>/static/addon/fancybox-2.1.5/jquery.fancybox.pack.js" type="text/javascript"></script>
        <script src="<?php echo BASE_URL ?>/static/js/jquery.touchwipe.min.js" type="text/javascript"></script>
		<script src="<?php echo BASE_URL ?>/static/default-template/js/script.js" type="text/javascript"></script>
        <!-- Datetime Picker JS -->
        <script src="<?php echo BASE_URL ?>/static/js/jquery.datetimepicker.js" type="text/javascript"></script>
        <!--Lean Slider v1.0.1-->
        <script src="<?php echo BASE_URL ?>/static/default-template/js/modernizr-2.6.1.min.js"></script>
        <script src="<?php echo BASE_URL ?>/static/default-template/js/lean-slider.js"></script>        
		<script>
		  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
		  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
		  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
		  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

		  ga('create', 'UA-58408257-1', 'auto');
		  ga('send', 'pageview');

		</script>
	</head>
	<body>   
        <!-- <div id="Ad_left" style="position:fixed;width:100px;height:300px;background-color:#bababa;top:90px"></div>  -->   
        <div class="myheader"> 
            <nav class="navbar navbar-default" role="navigation">
                <div class="container">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <!--<a class="navbar-brand" href="#">Brand</a>-->
                        <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'index', 'action'=>'index'),'index.index',true)?>" title=""><img src="<?php echo BASE_URL ?>/upload/cologo/logodvtnew1.png" width="auto" height="70px"/></a>
                    </div>
    
                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">                                    
                        <ul class="nav navbar-nav navbar-right">
                        <?php                          
                            if(!isset($info['userId']) && !$info['userId']){
                        ?>                    
                                <li><a id="loginRegis" class="btn btn-default" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'auth', 'action'=>'login'),'auth.login',true)?>" title="Đăng tin miễn phí"><span class="glyphicon glyphicon-pencil"></span>&nbsp; ĐĂNG TIN MIỄN PHÍ</a></li>
                                <li><a id="loginRegis" class="btn btn-default" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'auth', 'action'=>'login'),'auth.login',true)?>" title="Đăng nhập"><span class="glyphicon glyphicon-thumbs-up"></span>&nbsp; ĐĂNG NHẬP</a></li>
                                <li><a id="regisRegis" class="btn btn-default" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'auth', 'action'=>'regis'),'auth.regis',true)?>" title="Đăng ký"><span class="glyphicon glyphicon-plus-sign"></span>&nbsp; ĐĂNG KÝ</a></li>
                                <br/>
                                <li><a style="padding:3px 10px" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'forgotpass'),'user.forgotpass',true)?>" title="">Quên mật khẩu? Vui lòng nhấn vào đây</a></li>
                        <?php
                            }else{
                        ?>
                                <li><a class="btn btn-default" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'product', 'action'=>'post'),'product.post',true)?>" title="Đăng tin miễn phí"><span class="glyphicon glyphicon-pencil"></span>&nbsp; ĐĂNG TIN MIỄN PHÍ</a></li>
                                <li><a class="btn btn-default" href="<?php echo $this->url(array('module'=>'default', 'controller'=>'product', 'action'=>'postvip'),'product.postvip',true)?>" title="Đăng tin VIP"><span class="glyphicon glyphicon-star"></span>&nbsp; ĐĂNG TIN VIP</a></li>
                                <li><a class="btn btn-default" href="<?=$this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'recharge'),'user.recharge',true)?>" title="Nạp tiền vào tài khoản"><span class="glyphicon glyphicon-flash"></span>&nbsp; NẠP TIỀN</a></li>
                                <li><a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'index'),'user.index',true)?>"><span class="glyphicon glyphicon-user"></span>&nbsp; <?php echo $info['username'];?></a></li>
                                <li><a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'auth', 'action'=>'logout'),'auth.logout',true)?>"><span class="glyphicon glyphicon-log-out"></span>&nbsp; Đăng Xuất</a></li>
                        <?php
                            } 
                        ?>                                                      
                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container -->
            </nav>                               
        </div>
        
        <?php
            $controller = Zend_Controller_Front::getInstance()->getRequest()->getControllerName();
            $action = Zend_Controller_Front::getInstance()->getRequest()->getActionName();            
        ?>
        
        <div class="container">
            <div class="col-md-3" >                                         
                <?php
                    $modelCat = new Default_Model_Productcat(); 
                    $modelItem = new Default_Model_Productitem();
                    $catL = $modelCat->getAllData()->toArray();
                    foreach($catL as $cat){
                        $itemTempL = $modelItem->getDataByCat($cat['id'])->toArray(); 
                        $itemL[$cat['id']] = $itemTempL;
                    }
                ?>
                <ul class="sidebar-nav" <?php echo(($controller=='user'&&($action!='forgotpass'&&$action!='revivepass')) || ($controller=='product'&& ($action=='post'||$action=='postvip'||$action=='review'||$action=='result'||$action=='revive'||$action=='top')))?'style="display:none"':''?>>
                    <li class="sidebar-nav-header">
                        Danh Mục Sản Phẩm
                    </li>
                    <?php
                        foreach($catL as $cat){
                    ?>
                            <li <?php //if($_COOKIE['cat_'.$cat['id']]==0)echo 'class="active"';?>>
                                <span style="position:relative;" id="<?php echo 'cat_'.$cat['id']?>">
                                    <span class='glyphicon glyphicon-chevron-right <?php if($_COOKIE['cat_'.$cat['id']]==1)echo 'glyphicon-chevron-down';?>'></span>
                                    <a data="<?php echo $cat['id']?>" href="<?=$this->url(array('module'=>'default', 'controller'=>'index', 'action'=>'index', 'catId'=>$cat['id'], 'shortName'=>$cat['shortName']),'index.faId',true)?>" title="<?php echo $cat['name']?>" style="position:absolute;left:30px;width:87%"><?=$cat['name']?></a>
                                </span>
                                <ul <?php if($_COOKIE['cat_'.$cat['id']]==0)echo 'class="hidden"';?>>
                                <?php
                                    foreach($itemL[$cat['id']] as $item){
                                ?>
                                        <li><a href="<?=$this->url(array('module'=>'default', 'controller'=>'index', 'action'=>'index', 'catName'=>$cat['shortName'], 'itemId'=>$item['id'], 'shortName'=>$item['shortName']),'index.soId',true)?>" title="<?php echo $item['name']?>">
                                            <span class=""></span>                                
                                            <span class="text id_<?php echo $item['id'];?>"><?=$item['name']?></span></a>
                                        </li>
                                <?php
                                        
                                    }
                                ?>
                                </ul>
                            </li>
                    <?php
                        }
                    ?>
                    <li class="sidebar-nav-footer">
                    </li>
                </ul>
                
                <?php
                    if( ($controller=='user'&&($action!='forgotpass'&&$action!='revivepass')) || ($controller=='product' && ($action=='post'||$action=='postvip'||$action=='review'||$action=='result'||$action=='revive'||$action=='top')) ){
                ?>
                <ul class="sidebar-nav">
                    <li class="sidebar-nav-header">
                        Tài khoản
                    </li>
                    <li>
                        <span>
                            <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'index'),'user.index',true)?>" title="Thông tin tài khoản">
                                <span class='glyphicon glyphicon-user'></span>
                                <span class='text'>Thông tin tài khoản</span>
                            </a>
                        </span>
                    </li>
                    <li>
                        <span>
                            <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'product', 'action'=>'postvip'),'product.postvip',true)?>" title="Đăng tin VIP">
                                <span class='glyphicon glyphicon-star' style="color:red;"></span>                            
                                <span class='text' style="color:red;">Đăng tin VIP</span>
                            </a>
                        </span>
                    </li>
                    <li>
                        <span>
                            <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'product', 'action'=>'post'),'product.post',true)?>" title="Đăng tin miễn phí">
                                <span class='glyphicon glyphicon-pencil'></span>
                                <span class='text'>Đăng tin thường (miễn phí)</span>
                            </a>
                        </span>
                    </li>
                    <li>
                        <span>
                            <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'recharge'),'user.recharge',true)?>" title="Dùng thẻ cào điện thoại để thanh toán phí đăng tin">
                                <span class='glyphicon glyphicon-flash'></span>
                                <span class='text'>Nạp tiền vào tài khoản</span>
                            </a>
                        </span>
                    </li>
                    <li>
                        <span>
                            <a href="<?php echo $this->url(array('module'=>'default', 'controller'=>'user', 'action'=>'proman'),'user.proman',true)?>" title="Dùng thẻ cào điện thoại để thanh toán phí đăng tin">
                                <span class='glyphicon glyphicon-folder-open'></span>
                                <span class='text'>Quản lý tin rao</span>
                            </a>
                        </span>
                    </li>
                    <li>
                        <span>
                            <span class='glyphicon glyphicon-fire' style="color:red;"></span>
                            <span class='text' style="color:red;">Số dư: <?php echo number_format($userCheck['gold'],0,'.',',')?> VNĐ</span>
                        </span>
                    </li>
                    <li class="sidebar-nav-footer">
                    </li>
                </ul>
                <?php
                    }
                ?>
                
                                              
            </div>
            
                                    
            <?php echo $this->layout()->content; ?>
                        
        </div>
        <?php
            $configSite= new Zend_Config_Ini(CONFIG_PATH.'/website.ini', APPLICATION_ENV);
            $siteL=$configSite->website->toArray();
        ?>                
        <footer class="footer">
            <div class="container">
                <div class="col-md-3">
                    <iframe width="100%" height="100%" src="//www.youtube.com/embed/y6Sxv-sUYtM" frameborder="0" allowfullscreen></iframe>
                </div>
                <div class="col-md-3">
                    <h4><strong>Kết Nối - Theo Dõi</strong></h4>
                    <a href="http://www.facebook.com/choonlinedanang" target="_blank"><img src="<?php echo BASE_URL ?>/static/images/facebook.png" title="example" alt="example"/></a>
                    <a href="https://twitter.com"><img src="<?php echo BASE_URL ?>/static/images/twitter.png" title="example" alt="example"/></a>
                    <a href="http://youtube.com"><img src="<?php echo BASE_URL ?>/static/images/youtube.png" title="example" alt="example"/></a>
                    <a href="https://plus.google.com"><img src="<?php echo BASE_URL ?>/static/images/googleplus.png" title="example" alt="example"/></a>                    
                </div>
                <div class="col-md-3">
                    <h4><strong>Hỗ Trợ Khách Hàng</strong></h4>
                    <a class="text" href="">Quy Định Đăng Tin</a>
                    <a class="text" href="">Hướng Dẫn Đăng Tin</a>
                    <a class="text" href="">Liên Hệ - Gớp Ý</a>
                    <a class="text" href="">Liên Hệ Quãng Cáo</a>
                </div>
                <div class="col-md-3">
                    <div
                        class="fb-like-box" 
                        style="background-color:#FFFCF0" 
                        data-href="https://www.facebook.com/choonlinedanang"
                        data-width="248px"
                        data-height="230px" 
                        data-colorscheme="light"
                        data-show-faces="true" data-header="true"
                        data-stream="false"
                        data-show-border="true">
                    </div>
                </div>
            <script>(function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) return;
              js = d.createElement(s); js.id = id;
              js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=660641287321656&version=v2.0";
              fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'))</script>
            </div>
            <hr style="margin-bottom: -10px;"/>
            <div class="container" style="text-align: center;">
                <p>© 2014 - Bản quyền của DVT.GROUP</p>
            </div>
        </footer>        
        
	</body>
</html>